<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>绿地安全卫士</title>
    <script src="/static/index/index.js"></script>
</head>
<body>
<div  id="app">
    hello world
    <button @click="setSwiperItem()"> 增加滚动屏按钮</button>
    <button @click="setUser()">增加用户按钮</button>
    <button @click="setUserMessage()">点击增加消息</button>
    <index-menu></index-menu>
<!-- <img src="/static/image/test.png">-->


</div>
</body>
<script th:inline="javascript">
    Vue.use(httpVueLoader);
    $(function() {
        new Vue({
            el:"#app",
            data:{
                userOne:[],

            },
            mounted(){
                // this.testGet()
            },
            components:{
                'index-menu': 'url:/components/menu/indexMenu.vue'
            },
            methods:{

                testGet(){
                    let that=this
                    $.ajax({
                        url:"/getSwiperItems/"+1,
                        type:'get',
                        success(res){
                          console.log('滚动屏的数据输出',res)
                        },
                    })
                    $.ajax({
                        url:"/user/getUser/"+1,
                        type:'get',
                        success(res){
                            that.userOne=res
                            console.log('用户数据表',res)
                        },
                    })
                    $.ajax({
                        url:"/userMessage/getIsReadUserMessage/"+1+"/"+1,
                        type:'get',
                        success(res){
                            console.log('已读消息列表',res)
                        },
                    })
                    $.ajax({
                        url:"/userMessage/getIsReadUserMessage/"+1+"/"+0,
                        type:'get',
                        success(res){
                            console.log('未读消息列表',res)
                        },
                    })
                },
                setSwiperItem(){
                    $.ajax({
                        url:"/setSwiperItem",
                        type:'post',
                        data:{
                            imgUrl:'/测试保存.jpg',
                            title:'采集的样本2',
                            address:'中国福建',
                        },
                        success(res){
                            console.log(res)
                        },
                    })
                },
                setUser(){
                    $.ajax({
                        url:"/user/setUser",
                        type:'post',
                        data:{
                            userName:'余维华',
                            realName:'余维华',
                            password:'123456',
                            phone:'13065162873',
                            email:'cick-y@foxmail.com',
                            userPhotoUrl:'/cick-y.jpg'
                        },
                        success(res){
                            console.log(res)
                        },
                    })
                },
                setUserMessage(){
                    $.ajax({
                        url:"/userMessage/save",
                        type:'post',
                        data:{
                            content:"绿地安全卫士开始正式上线啦！",
                            user:this.userOne.id,
                        },
                        success(res){
                            console.log(res)
                        },
                    })
                }
            }

        })
    })


</script>
<style>
    .el-menu-vertical-demo:not(.el-menu--collapse) {
        width: 200px;
        min-height: 400px;
    }
</style>
</html>